This example checks the value of a check box to determine whether or not to display headings in the grid.
Private Sub Check1_Click ()
If Check1.Value = vbChecked Then
DataGrid1.HeadLines = 2 ' If checked,two lines in
' column headings.
Else
DataGrid1.HeadLines = 0 ' No headings.
End If
End Sub